package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/28 18:01
 *
 *@Desc: 重叠卡片风格（OverLapTransformer）
 */
class OverLapTransformer : ViewPager2.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        view.translationX = -position * view.width * 0.3f
        view.scaleY = 1 - 0.1f * Math.abs(position)
        view.scaleX = 1 - 0.1f * Math.abs(position)
        view.alpha = if (Math.abs(position) <= 1f) 1f else 0f
    }
}
